/**
 *  Copyright 2013 University Pierre & Marie Curie - UMR CNRS 7606 (LIP6/MoVe)
 *  All rights reserved.   This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  Initial contributor:
 *    Lom M. Hillah - <lom-messan.hillah@lip6.fr>
 *
 *  Mailing list:
 *    lom-messan.hillah@lip6.fr
 */
package fr.lip6.msr4j.main;

import org.slf4j.Logger;

import fr.lip6.msr4j.asf.datamodel.ASFProjectsCommitters;
import fr.lip6.msr4j.asf.utils.config.Printer;
import fr.lip6.msr4j.asf.utils.parsers.ASFCommitterIndexesParser;
import fr.lip6.msr4j.utils.config.MSR4JLogger;

public final class Main {

	private Main() {
		super();
	}

	/**
	 * Launches the application.
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		
		  final Logger logger =
		  MSR4JLogger.getLogger(Main.class.getCanonicalName());
		/*final
		 * PropertiesManager spm = new PropertiesManager(args[0]);
		 * spm.loadUserProperties(); spm.setUserDBPath();
		 * */
		 

		try {
			ASFCommitterIndexesParser parser = new ASFCommitterIndexesParser();
			ASFProjectsCommitters projects = parser.parseIndex();
			// Printer.showProjects(projects);
			//Printer.showCommitters(projects);
			Printer.showTopLevelProjects(projects);
			//Printer.showASFProjects(projects);
			parser = null;
			projects = null;
			/*
			 * DBHandler dbh = new
			 * SequentialASFCommittersDBHandler(Paths.DB_PATH); dbh.removeDb();
			 * dbh.createDb(); dbh.populateDB(projects); dbh.shutDown(); dbh =
			 * null;
			 */
			/*
			 * Parse svn urls and add them to svnurls.properties
			 * SVNURLIndexParser suip = new SVNURLIndexParser(); File svnurls =
			 * suip.parseIndex(); PropertiesManager.showFileContent(svnurls);
			 */
			/*
			 * Fetch one of them
			 * spm.setUserPropertiesPath(svnurls.getAbsolutePath());
			 * spm.loadUserProperties(); Set<Object> keys =
			 * spm.getPropertiesKeys(); String[] keysArray = keys.toArray(new
			 * String[0]);
			 */
			// String svnname = (String)keys.iterator().next();
			/*
			 * How many projects to fetch?
			 * log.info("How many discovered SVN URLs = " + keysArray.length);
			 */
			/*
			 * int i = 0; String svnurl; SVNURL svn; File destPath; for (i = 10;
			 * i < 15 && i <keysArray.length; i++) { svnurl =
			 * spm.getProperty(keysArray[i]); svn =
			 * SVNURL.parseURIEncoded(svnurl); destPath = new
			 * File(URLS.SVN_BASE_PATH + keysArray[i]); if (!destPath.exists())
			 * { WorkingCopyFetcher.checkout(svn, SVNRevision.HEAD, destPath,
			 * false); log.info("Finished fetching repository: " +
			 * keysArray[i]);
			 * 
			 * } else { WorkingCopyFetcher.update(destPath, SVNRevision.HEAD,
			 * SVNDepth.INFINITY, false, true);
			 * log.info("Finished updating repository: " + keysArray[i]); } }
			 */

		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		System.exit(0);
	}

}
